This popup calendar/date chooser is very simple to set up within the MegaBBS environment. Two custom functions have been added, one to includes/include.asp and one to languages/language-config.asp, to facilitate use.

------------------------------------------------------------------------


BBS.GetCalendarDateFormat()

This function returns the appropriate format for the input provided through the calendar, depending on the date format the administrator has chosen for their forum.


------------------------------------------------------------------------


Language.GetCalendarLanguage()

This function returns the path to the appropriate language file for the calendar, depending on what languages have been installed onto the forum and what the user has chosen to view it in.


------------------------------------------------------------------------

The first step to integrating the calendar into your page is to include the neccessary files on the page - that is, the stylesheet, the two main code files, and the language file. To do so, simply paste the following lines near the top of the page:


' Include the neccessary files for calendar
dictEnvironment.item("C-EXTRAHEADTAG") = dictEnvironment.item("C-EXTRAHEADTAG") & "<style type='text/css'>@import url(" & sBBSTemplateRoot & "/calendar.css);</style>" & CRLF
dictEnvironment.item("C-EXTRAHEADTAG") = dictEnvironment.item("C-EXTRAHEADTAG") & "<script type='text/javascript' src='jscalendar/calendar.js'></script>" & CRLF
dictEnvironment.item("C-EXTRAHEADTAG") = dictEnvironment.item("C-EXTRAHEADTAG") & "<script type='text/javascript' src='" & Language.GetCalendarLanguage() & "'></script>" & CRLF
dictEnvironment.item("C-EXTRAHEADTAG") = dictEnvironment.item("C-EXTRAHEADTAG") & "<script type='text/javascript' src='jscalendar/calendar-setup.js'></script>" & CRLF

Note you may need to alter the paths to the files on the third and fifth lines, depending on where the page you are integrating is located.

------------------------------------------------------------------------

Next you need to set up the input area where the date is to go, and the button that triggers the showing of the calendar. A sample piece of code is shown below.

<form action='example.asp' method='get'>
<input type='text' class='bbstextbox' name='startdate' id='startdate'> <button class='bbsbutton' id='startdate-trigger'>...</button>
<input type='submit' class='bbsbutton' value='Submit'>
</form>

------------------------------------------------------------------------

Finally, just after the end of the form, you need to add the appropriate Javascript to create the calendar. A sample piece of Javascript for the above form is:
<script type='text/javascript'>
Calendar.setup({
	inputField : 'startdate',
	ifFormat   : '<%=BBS.GetCalendarDateFormat()%>',
	button     : 'startdate-trigger'
});
</script>

------------------------------------------------------------------------

This is a very basic example. For further examples, have a look at search/query.asp and calendar/add-event.asp

For further information, head over to the homepage of the calendar, http://dynarch.com/mishoo/calendar.epl